global
  maxconn 1024 
  daemon
  pidfile <%= pid_file %>

defaults
  mode http
  maxconn 1024
  option  httplog
  option  dontlognull
  retries 3
  timeout connect 5s
  timeout client 60s
  timeout server 60s


listen stats *:4444
  mode            http
  log             global
  maxconn 10
  clitimeout      100s
  srvtimeout      100s
  contimeout      100s
  timeout queue   100s
  stats enable
  stats hide-version
  stats refresh 30s
  stats show-node
  stats uri /haproxy?stats


frontend rotating_proxies
  bind *:<%= port %>
  default_backend tor
  option http_proxy

backend tor
  option http_proxy
  balance leastconn # http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#balance

  <% backends.each do |b| %>
  server <%= b[:name] %><%= b[:port] %> <%= b[:addr] %>:<%= b[:port] %>
  <% end %>
